<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul>
      <li>1</li>
      <li>2</li>
      <li>3</li>
    </ul>

    <script>
      const wmap = new WeakMap();
      let lisEl = document.querySelectorAll("li");
      for (const li of lisEl) {
        wmap.set(li, { id: li.innerHTML, name: `姓名${li.innerHTML}` });
      }
      lisEl[0].remove();
      lisEl = null;
      console.log(wmap);
    </script>
  </body>
</html>
